from appium.webdriver.common.appiumby import AppiumBy
from basic.basepage import BasePage



class PageShoppingNew(BasePage):
    def buy_to_new_product_list(self):
        new_product_list_locator = AppiumBy.ANDROID_UIAUTOMATOR,"new UiSelector().className(\"android.view.ViewGroup\").instance(27)"
        smart_wearables_locator = AppiumBy.ANDROID_UIAUTOMATOR,"new UiSelector().className(\"android.widget.ImageView\").instance(6)"
        go_buy_locator = AppiumBy.ANDROID_UIAUTOMATOR,"new UiSelector().text(\"去购买\").instance(1)"
        buy_locator = AppiumBy.ANDROID_UIAUTOMATOR,"new UiSelector().resourceId(\"com.xiaomi.shop.plugin.rank:id/detail_product_buy_tv\").instance(0)"
        self.click(new_product_list_locator)
        self.click(smart_wearables_locator)
        self.click(go_buy_locator)
        self.click(buy_locator)
        return self
    def goto_shopping_cart(self):
        from page.page_shopping.page_function_shopping_car import PageShoppingCart
        return PageShoppingCart()


